﻿using DocumentFormat.OpenXml.Lite.DrawingML.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.DrawingML.Style
{
    [XmlRoot("alphaBiLevel", Namespace = Constants.Main)]
    public class AlphaBiLevel : XmlSerializable, IBlipElement
    {
        [XmlAttribute("tresh", Form = XmlSchemaForm.Qualified)]
        public int Treshold { get; set; }

        public AlphaBiLevel() { }
    }

    [XmlRoot("alphaInv", Namespace = Constants.Main)]
    public class AlphaInverse : XmlSerializable, IBlipElement
    {
        [XmlElement("", Namespace = Constants.Main)]
        public IColorElement ColorElement { get; set; }

        public AlphaInverse() { }
    }

    [XmlRoot("alphaCeiling", Namespace = Constants.Main)]
    public class AlphaCeiling : XmlSerializable, IBlipElement
    {
        public AlphaCeiling() { }
    }

    [XmlRoot("alphaFloor", Namespace = Constants.Main)]
    public class AlphaFloor : XmlSerializable, IBlipElement
    {
        public AlphaFloor() { }
    }

    [XmlRoot("alphaMod", Namespace = Constants.Main)]
    public class AlphaModulate : XmlSerializable, IBlipElement
    {
        [XmlElement("cont", Namespace = Constants.Main)]
        public Container Container { get; set; }

        public AlphaModulate() { }
    }

    [XmlRoot("alphaModFix", Namespace = Constants.Main)]
    public class AlphaModulateFixed : XmlSerializable, IBlipElement
    {
        [Optional]
        [XmlAttribute("amt", Form = XmlSchemaForm.Qualified)]
        public int Amount { get; set; }

        public AlphaModulateFixed() { }
    }

    [XmlRoot("alphaRepl", Namespace = Constants.Main)]
    public class AlphaReplace : XmlSerializable, IBlipElement
    {
        [Optional]
        [XmlAttribute("a", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Alpha { get; set; }

        public AlphaReplace() { }
    }

    [XmlRoot("biLevel", Namespace = Constants.Main)]
    public class BiLevel : XmlSerializable, IBlipElement
    {
        [XmlAttribute("tresh", Form = XmlSchemaForm.Qualified)]
        public int Treshold { get; set; }

        public BiLevel() { }
    }

    [XmlRoot("blur", Namespace = Constants.Main)]
    public class Blur : XmlSerializable, IBlipElement
    {
        [Optional]
        [XmlAttribute("rad", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Radius { get; set; }

        [Optional]
        [XmlAttribute("grow", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> GrowBounds { get; set; }

        public Blur() { }
    }

    [XmlRoot("clrRepl", Namespace = Constants.Main)]
    public class SolidColorReplacememnt : XmlSerializable, IBlipElement
    {
        [XmlElement("", Namespace = Constants.Main)]
        public IColorElement ColorElement { get; set; }

        public SolidColorReplacememnt() { }
    }

    [XmlRoot("duotone", Namespace = Constants.Main)]
    public class Duotone : XmlSerializable, IBlipElement
    {
        [XmlElement("", Namespace = Constants.Main)]
        public IColorElement[] ColorElement { get; set; }

        public Duotone() 
        {
            ColorElement = new IColorElement[2];
        }
    }

    [XmlRoot("clrChange", Namespace = Constants.Main)]
    public class ColorChange : XmlSerializable, IBlipElement
    {
        [Optional]
        [XmlAttribute("useA", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> ConsiderAlphaValues { get; set; }

        [XmlElement("clrFrom", Namespace = Constants.Main)]
        public Color.Color ColorFrom { get; set; }

        [XmlElement("clrTo", Namespace = Constants.Main)]
        public Color.Color ColorTo { get; set; }

        public ColorChange() { }
    }

    [XmlRoot("grayscl", Namespace = Constants.Main)]
    public class GrayScale : XmlSerializable, IBlipElement
    {
        public GrayScale() { }
    }

    [XmlRoot("hsl", Namespace = Constants.Main)]
    public class HSL : XmlSerializable, IBlipElement
    {
        [Optional]
        [XmlAttribute("hue", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> Hue { get; set; }

        [Optional]
        [XmlAttribute("sat", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> Saturation { get; set; }

        [Optional]
        [XmlAttribute("lum", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> Luminance { get; set; }

        public HSL() { }
    }

    [XmlRoot("lum", Namespace = Constants.Main)]
    public class Luminance : XmlSerializable, IBlipElement
    {
        [Optional]
        [XmlAttribute("bright", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Bright { get; set; }

        [Optional]
        [XmlAttribute("contrast", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Contrast { get; set; }

        public Luminance() { }
    }

    [XmlRoot("tint", Namespace = Constants.Main)]
    public class Tint : XmlSerializable, IBlipElement
    {
        [Optional]
        [XmlAttribute("hue", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Hue { get; set; }

        [Optional]
        [XmlAttribute("amt", Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Amount { get; set; }

        public Tint() { }
    }

    [XmlRoot("fillOverlay", Namespace = Constants.Main)]
    public class FillOverlay : XmlSerializable, IBlipElement
    {
        [XmlAttribute("blend", Form = XmlSchemaForm.Qualified)]
        public ST_BlendMode Mode { get; set; }

        [XmlElement("", Namespace = Constants.Main)]
        public IFillProperty Element { get; set; }

        public FillOverlay() { }
    }
}
